<template>
	<view class="item" @click="checkDevice('XY')">
		<view>
			<view class="title">血压计</view>
		</view>
		<view>
			<view v-if="!xyDevice">未绑定设备</view>
			<view v-else>
				<view>设备名称：{{xyDevice.name}}</view>
				<view>地址：{{xyDevice.deviceId}}</view>
			</view>
			
		</view>
	</view>
	<view class="item" @click="checkDevice('DK')">
		<view>
			<view class="title">读卡器</view>
		</view>
		<view>
			<view v-if="!xyDevice">未绑定设备</view>
			<view v-else>设备名称：</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				deviceList:[
					{
						title:'血压计',
						value:'1'
					},
					{
						title:'读卡器',
						value:'2'
					},
				],
				xyDevice:'',
			}
		},
		onLoad() {
			
		},
		onShow() {
			let that=this
			uni.getStorage({
				key: 'XY',
				success: function(res) {
					that.xyDevice=res.data
				}
			})
		},
		methods: {
			checkDevice(data) {
				console.log(data);
				uni.navigateTo({
					url: `/pages/bluetooth/bluetooth?title=${data}`
				})

			}
		}
	}
</script>

<style>
	.item {
		box-sizing: border-box;
		padding: 30rpx;
		font-size: 28rpx;
		border-bottom: 1px solid #ccc;
		flex: 1
	}

	.title {
		font-size: 18px;
	}
</style>